#!/bin/bash

# Create image files
echo "Creating image files..."
for x in 0 1 2; do
	dd if=/dev/zero of=usb${x}.img bs=512 count=2880	
done

# Associate
echo "Associating images with devices"
for x in 0 1 2; do
	sudo losetup /dev/loop${x} usb${x}.img
done

#format the devices
echo "Formatting the devices..."
for x in 0 1 2; do
	sudo mkfs.vfat /dev/loop${x}
done

# Mount
echo "Creating directory and mounting..."
for x in 0 1; do
	mkdir mnt_dev${x}
	sudo mount -t vfat -o rw,sync /dev/loop${x} mnt_dev${x}
done

echo ""
echo "Don!"
#mkdir mnt_dev0
# Mount
